package com.orange.lswidget.widgets.event;

import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;

import com.orange.lswidget.LSWidgetManager;
import com.orange.lswidget.LSWidgetProvider;
import com.orange.lswidget.R;
import com.orange.util.LSEventUtils;

public class EventLSWidgetProvider extends LSWidgetProvider {

	@Override
	public void onDeleted(Context context) {
		EventLSWidgetService.stopService(context);
		super.onDeleted(context);
	}

	@Override
	public void onDisabled(Context context) {
		EventLSWidgetService.stopService(context);
		super.onDisabled(context);
	}

	@Override
	public void onEnabled(Context context) {
		EventLSWidgetService.startService(context);
		super.onEnabled(context);
	}

	@Override
	public void onReceive(Context context, Intent intent) {
		super.onReceive(context, intent);
	}

	@Override
	public void onUpdate(Context context, int viewType) {
		EventLSWidgetService.startService(context);
		RemoteViews remoteViews = new RemoteViews(LSEventUtils.sPackageName,
				R.layout.event);
		LSWidgetManager.updateLSWidgetType(viewType, remoteViews, false);
		super.onUpdate(context, viewType);
	}

}